const jwt = require("jsonwebtoken");
const { security } = require("./tokentime");

// 生成token
function genToken(uid, scope = "admin") {
  const token = jwt.sign(
    {
      uid,
      scope,
    },
    security.secretKey,
    {
      expiresIn: security.expiresIn,
    }
  );
  return token;
}

module.exports = {
  genToken,
};